package com.ssh.api.action;

import java.util.List;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionSupport;
import com.ssh.common.util.JsonResult;
import com.ssh.entity.Employee;
import com.ssh.entity.Task;
import com.ssh.manager.TaskProductEmployeeManager;
@Controller
@ParentPackage("admin")
@Scope("prototype")
@Results(value={
@Result(name="findAllByEid", type="json", params={"root","tasks","excludeproperties","tasks\\[\\d+\\]\\.id, tasks\\[\\d+\\]\\.name," +
		"tasks\\[\\d+\\]\\.content, tasks\\[\\d+\\]\\.createDate, tasks\\[\\d+\\]\\.startDate, tasks\\[\\d+\\]\\.endDate"}),
})
public class TaskClientAction extends ActionSupport{
	private static final long serialVersionUID = -268757009268660942L;
	@Resource(name="taskProductEmployeeManagerImpl")
	private TaskProductEmployeeManager taskProductEmployeeManager;
	
	private JsonResult jr=new JsonResult();
	private List<Task> tasks;
	private Employee employee;
	public JsonResult getJr() {
		return jr;
	}
	public void setJr(JsonResult jr) {
		this.jr = jr;
	}
	public List<Task> getTasks() {
		return tasks;
	}
	public void setTasks(List<Task> tasks) {
		this.tasks = tasks;
	}
	public Employee getEmployee() {
		return employee;
	}
	public void setEmployee(Employee employee) {
		this.employee = employee;
	}
	
	/**
	 * 根据业务员ID查询未过期的任务
	 * @return
	 */
	public String findAllByEid(){
		tasks = taskProductEmployeeManager.findTaskByEid(employee.getId());
		return "findAllByEid";
	}
}
